package com.newsmanagement.controller.frontdesk;

import com.newsmanagement.entity.ReturnedMessages;
import com.newsmanagement.service.ISocialDevelopmentContentService;
import com.newsmanagement.service.ISocialDevelopmentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @author xbr
 * 2017.12.04 11:24
 * 后台系统 社会动态评论管理
 */
@Controller
@RequestMapping("frontDevelopmentContent")
public class SocialDevelopmentContentFrontController {

    @Autowired
    private ISocialDevelopmentContentService socialDevelopmentContentService;

    /**
     * 发布动态评论（即保存动态评论）
     * @param eumId 操作的用户id
     * @param developmentId 动态id
     * @param contentTxt 评论内容
     * @return ReturnedMessages
     * http://localhost:8080/frontDevelopmentContent/releaseContent?eumId=1&developmentId=3&contentTxt=erert
     */
    @RequestMapping("releaseContent")
    @ResponseBody
    public ReturnedMessages releaseDevelopment(
            @RequestParam(value = "eumId") Integer eumId ,
            @RequestParam(value = "developmentId") Integer developmentId ,
            @RequestParam(value = "contentTxt") String contentTxt
    ){

        return socialDevelopmentContentService.releaseContent(eumId ,developmentId ,contentTxt);
    }

    /**
     * 查询动态下所有评论
     * @param developmentId 动态id
     * @return ReturnedMessages
     * http://localhost:8080/frontDevelopmentContent/allComment?developmentId=3
     */
    @RequestMapping("allComment")
    @ResponseBody
    public ReturnedMessages allComment(
            @RequestParam(value = "developmentId") Integer developmentId
    ){

        return socialDevelopmentContentService.allCommentByDevelopmentIdList(developmentId);
    }

}
